package second;
public class Person {
    private int age;
    private String name;
    public Person(){
        age=18;
    }
    public Person(int age,String name){
        this.age=age;
        this.name=name;
    }
    public void setAge(int age){
        if(age>=0 && age<=130)
            this.age=age;
        else
            System.out.println("设置年龄错误!");
    }
    public int getAge(){
        System.out.println("年龄；"+age);
        return age;
    }
    public void showInfo(){
        System.out.println("年龄:"+age+" "+"姓名:"+name);
    }
}
